package com.link2room.ironhide.entity;

import com.link2room.common.entity.BaseEntity;
import org.hibernate.annotations.DynamicInsert;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * Created by sss on 2016/10/11.
 */
@Entity
@Table(name = "l2r_city")
@DynamicInsert
public class L2RCity extends BaseEntity{
    public enum L2RCity_{
        provinceCode,cityCode,cityName,searchCode
    }
    /**
     * 省份代码
     */
    private Long provinceCode;
    /**
     * 城市代码
     */
    private Long cityCode;
    /**
     * 城市名称
     */
    private String cityName;
    /**
     * 检索代码
     */
    private String searchCode;

    @Basic
    @Column(name = "province_code", nullable = true)
    public Long getProvinceCode() {
        return provinceCode;
    }

    public void setProvinceCode(Long provinceCode) {
        this.provinceCode = provinceCode;
    }

    @Basic
    @Column(name = "city_code", nullable = true)
    public Long getCityCode() {
        return cityCode;
    }

    public void setCityCode(Long cityCode) {
        this.cityCode = cityCode;
    }

    @Basic
    @Column(name = "city_name", nullable = false, length = 16)
    public String getCityName() {
        return cityName;
    }

    public void setCityName(String cityName) {
        this.cityName = cityName;
    }

    @Basic
    @Column(name = "search_code", nullable = true, length = 64)
    public String getSearchCode() {
        return searchCode;
    }

    public void setSearchCode(String searchCode) {
        this.searchCode = searchCode;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        L2RCity l2RCity = (L2RCity) o;

        if (provinceCode != null ? !provinceCode.equals(l2RCity.provinceCode) : l2RCity.provinceCode != null)
            return false;
        if (cityCode != null ? !cityCode.equals(l2RCity.cityCode) : l2RCity.cityCode != null) return false;
        if (cityName != null ? !cityName.equals(l2RCity.cityName) : l2RCity.cityName != null) return false;
        if (searchCode != null ? !searchCode.equals(l2RCity.searchCode) : l2RCity.searchCode != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = provinceCode != null ? provinceCode.hashCode() : 0;
        result = 31 * result + (cityCode != null ? cityCode.hashCode() : 0);
        result = 31 * result + (cityName != null ? cityName.hashCode() : 0);
        result = 31 * result + (searchCode != null ? searchCode.hashCode() : 0);
        return result;
    }
}
